text glommed together for this purpose. one keystroke, but consecutive 'killLines' have their last deleted text" refers to text that was deleted in about text that was merely deleted. Ordinarily, "the is different from 'paste' in that 'paste' doesn't know 'cut', 'copy'd, or deleted in any way. Note that 'yank' • yank - insert the last piece of text that has been • winSearch - brings up search and replace dialog uppercase in the current word • upcaseWord - convert all lowercase letters to uppercase in the current region • upcaseRegion - convert all lowercase letters to • undo - undo the last action that has not been undone • tileVert - tile the windows vertically set horizontal and vertical amount • tileOrder - offset each window from the previous by a • tileHor - tile the windows horizontally • tileFull - make all windows "full screen" • startKeyboardMacro - start recording keyboard macro shift key in the next keystroke keystroke combination, in the same manner as using the • startEscape - used to further modify the next • shiftRegionRight - shift the current region right a tab • shiftRegionLeft - shifts the current region left a tab in macros • setNamedMark - set a named mark in a file, use 'mark' • setMark - set the current mark to the insertion point • set - macro-only func to set var values, see examples next occurance • searchRfa - replace the current selection and find • searchReplace - replace the current selection current file • searchRall - replace all futher occurances in the • searchEnter - use current selection for future searches the up arrow in the vertical scrollbar is selected • scrollUpLine - same action as that which occurs when the down arrow in the vertical scrollbar is selected • scrollDownLine - same action as that which occurs when • saveVars - save variable state, see 'restoreVars' • revert - revert the file to it's last saved version see 'saveVars' • restoreVars - restore variables to saved state, • repeatSearchForward - repeat search forward • repeatSearchBackward - repeat search backward not redone • redo - redo the next action that has been undone but • quickSort - sort the lines in the current region line • previousLine - move insertion point to the previous • prevWindow - select previous window declaration • prevFunc - hilite first line of previous 'C' function • prevLineSelect - extend selection to the previous line in the next keystroke combination, in the same manner as using the shift key • prefixChar - used to further modify the next keystroke • pasteClip - paste to named clipboard or 'copy' • paste - insert the last chunk of text created by 'cut' • pageForward - display next screenful • pageBack - display previous screenful one and move the insertion point to it • openLine - insert a new line following the current • nextWindow - select next window • nextLine - move insertion point to next line declaration • nextFunc - select first line of next 'C' function • nextLineSelect - extend selection to the next line insertion point character that matches the character after the current • matchBrace - moves the insertion point to the selected. the region between the insertion point and the mark is around the old selection. If there is not a selection, is unhilited, leaving the mark and the insertion point If there is a currently hilited selection, the selection • markHilite - This is the 'Hilite' from the 'Edit' menu. text take effect bindings or macro definitions are present in the loaded nothing is hilited. 'load'ing means that whatever • loadFile - loads hilited text, or entire window if • killWindow - kill current window and move succeeding lines up one. of the line. If the line has no text, delete the line • killLine - kill text from insertion point to the end alphaBits' file. function can be used to create bindings in the ' representing and modifiers into the current window. This • keyCode - insert the key code along w/ a string necessary. of the keydown event, plus a modifier string, if • keyAscii - insert the ascii representation (in decimal) macro (including the keyboard macro) many times. window. Also can be used to execute any function or times. "option-u 44 =" inserts 44 '='s into the current • iterationCount - allows actions to be repeated many number along w/ the total number of lines in the file is on the first line shown, and display the current line • insertToTop - make the line that the insertion point undoable. corresponding file into the current window. Not • insertFile - prompts for a file name and inserts the text. • insertAscii - prompts for an ASCII code and inserts into find the include file. the suffix and use the var 'includePath' to try to • includeFile - expand the current selection to include • gotoMark - goto named mark, use 'mark' in macros. • gotoLine - go to a line number the current window and paste the complete path-name of the chosen file into • getPathName - present the user w/ a SFGetFIle dialog • getHelp - display help dialog current insertion ponit • getAscii - displays the ASCII code for character at memory reserves of ALPHA • freeMem - give a rough approximation of the current • forwardWord - move insertion one word forward • forwardChar - move insertion one character forward forward • forwardCharSelect - extend selection one character • findFile - open a new file definition to use the file 'cTAGS' to locate the function's • findTag - prompt user for a function name and attempt • fillRegion - as above for current region by white-space lines paragraph is here defined as any block of text delimited between the columns 'leftFillColumn' and 'fillColumn'. A in the current paragraph in order for all text to fit • fillParagraph - inserts/deletes lines and moves text window • fileStats - displays chars, words, and lines for current • fileRemove - prompts for a file, and removes it modification time, and creation time creator, sizes of both data and resource forks, last • fileInfo - prompts for a file, and displays type, macro • executeKeyboardMacro - execute the current keyboard w/ the current insertion point • exchangePointAndmark - exchange the current 'mark' • endOfLine - move insertion to the end of the line • endOfBuffer - move insertion to the end of the buffer • endKeyboardMacro - stop recording keyboard macro • endLineSelect - extend selection to the end of the line buffer • endBufferSelect - extend selection to the end of the correct line and open a new line • electricRightBrace - insert a right brace on the line and indent to the "proper" level. sure that the brace is on a new line, open a further • electricLeftBrace - if 'electricLBrace' is set, make into the current buffer keyboard macro and then dumps a definition of the macro • dumpMacro - prompts the user to name the current lowercase in current word • downcaseWord - changes all uppercase letters to lowercase in current region • downcaseRegion - changes all uppercase letters to • doZoom - zooms the current window • doQuit - quits ALPHA • doTab - insert a tab indent the new line electricSemi' is set, insert a carriage return and • doElectricSemi - insert semicolon, and if ' • doSave - saves current window • doNew - opens an untitled window • deleteWord - delete word after cursor • deleteChar - delete char AFTER cursor • cutClip - cut to named clipboard • cut - deletes and saves region position (row and col) in the status line. • currentPosition - displays number of lines and current a file called 'cTAGS'. and saves the locations of any function declarations in • createTagFile - searches all files in current file set • copyClip - copy to named clipboard • copy - copy region • closeAll - close all windows line if the variable 'indendOnCR' is set to 'on' • carriageReturn - insert carriage return, indent new • capitalizeWord - capitalize word region • capitalizeRegion - capitalize all words in selected the line • beginningOfLine - move insertion to the beginning of of the buffer • beginningOfBuffer - move insertion to the beginning beginning of the line • beginningLineSelect - extend selection to the beginning of the buffer • beginningBufferSelect - extend selection to the brackets that encloses the current selection • balance - selects smallest set of parens, braces, or • backwardWord - moves insertion one char back • backwardDeleteWord - deletes previous work • backwardChar - moves insertion one char back • backwardCharSelect - extends selection one char back • abortEm - aborts whatever is currently happening through pattern-matching the string "^[^ \t#]*(.*)$"". above, 'C' functions are detected not through parsing, but Several functions deal with 'C' functions. As stated selected. commands also work on blocks of text that are currently status line will say 'Mark set'. All of the region You will always know when the mark is set because the commands such as 'beginningOfBuffer' or 'endOfBuffer'. current 'mark' is set by the 'setMark' command, or between the current 'mark', and the insertion point. The from emacs and are used to refer to all of the text Many of the commands manipulate 'regions'. Regions come ========================== Function Summary during normal text insertion (typing) in length are automatically wrapped wordWrap • if true, lines exceeding 'fillColumn' the folder specified by 'backupFolder' useBackupFolder • if true, backup files are placed in tagFile • complete path-name of tag file tabSize • Default number of characters per tab. suppressHeader • Suppress header on printed pages. comes up w/ nothing. a prompt for a file. When 2, ALPHA buffer. When 0, ALPHA comes up w/ startWithNew • When one, ALPHA comes up w/ new for a regular expression regExpr • flag set if searchAgain should look commands should affect. numWinsToTile • specifies the number of windows tile on. foreign keyboard will want this turned sequences are not usable. Owners of "dead keys". If TRUE, some option resource w/ one that does not have noRemapOption • When set, does not overlay system matchWords • Match words on searches. leftFillColumn • Number of blanks at left of lines. keepBackup • Keeps old version in .BAK indentOnCR • Auto-indent on carriage return. "Disk:C:edit;Disk:C:THINK C:include;;" by using consecutive semi-colons as: The current directory can be included "Disk:C:edit;Disk:C:THINK C:include;" separated by semi-colons, such as: directories to search for include files, includePath • A list of the path-names of the ignoreCase • Search is case-insensitive. ALPHA uses to find function declarations. funcExpr • Set to the regular expression that specified by 'defHeight' and 'defWidth'. same place, and have the dimension fullScreen • If on, all windows are start in the mere file names. fullNames • Windows display pathnames instead of displaying. dialog always resets this before forward • set when searching forward. The 'findFile' files. fontSize • Default size of fonts used to display "fill" functions. See 'leftFillColumn' fillColumn • Number of columns use as limit for electricSemi • Electric 'C' semicolon on. elecRBrace • Electric 'C' right brace on. elecLBrace • Electric 'C' left brace on. width in pixels. defWidth • If 'fullScreen' set, this is default height in pixels. defHeight • If 'fullScreen' set, this is default will want this turned off. to key codes. Those w/ foreign keyboards "bind 'c' ...." are internally converted convertToCodes • if non-zero, all bindings of the form by the complete pathname in 'backupFolder'. files are placed in the folder specified backupFolder • if 'useBackupFolder' is true, backup When variables are set: ========================== Explanation of Variables procedures w/ or w/o parameters can be identified. the last word in the line is used. Therefore, Pascal function's name. If there is no '(' in the selected line, previous to the first '(' in the selected line as the in mind is that the tag routines use the complete word tags for other languages. The only thing you need to bear of 'C' declarations, you could also use it to generate Note that not only can you customize this to your style "^[^ \t#]*(.*)$"" is the following: funcExpr" to suit your own style. The default expression you declare your functions differently, you can change " declarations. In other words, we don't parse the text. If in the string variable "funcExpr" to look for function ALPHA's tag generating routines use the regular expression tag file specified by the "tagFile" string variable. functions. When searching for a tag, ALPHA looks for the ALPHA supports the use of tags to find declarations of ========================== Defining and Using 'C' Tags • yankclip - yank from named clipboard • type - inserts string into current window works outside macros as well • set - used to set variable contents (mirrors command that • search - search for string, based on current flag values • saveVars - save all numeric vars • restoreVars - restore all numeric vars to saved values • replaceFindAgain - replace and find again • replace - replace selection • menu - used to instantiate the user menu • mark - create named mark • goto - goto named mark • fileSet - used to define file sets • deletemark - delete named mark • deleteclip - delete named clipboard • define - used to name macro • cutclip - cut selected text to named clipboard • copyclip - copy selected text to named clipboard • clipsearch - search for contents of named clipboard resource fork of Alpha • acmd - execute named acmd, which must be in the of use and syntax. macros, see the distributed 'AlphaBits' file for examples The following are commands that can only be executed from dumping it to a buffer. is compiled in these cases, try creating such a macro and calls, and setting named marks and clipboards. To see what commands include the search and replace commands, 'ACMD' again prompting every time the macro is executed. These the result of the prompt into the macro, as opposed to Several commands which prompt for input actually compile in the file, hmmm... macro on the next 100 lines, but there are only 20 lines macros, so if you use the iteration count to execute a Currently there is little or no error checking done in loose! less than 80 characters in length, or all hell will break Macros can be of any length, but individual lines must be example macros have been provided in the 'AlphaBits' file. to keep it, just put it in the 'AlphaBits' file. Several things around, add functions, and reload it. If you want record a macro and dump it to a file. Play w/ it, change enter text. One good way to learn to write macros is to they found it. The keyword "type" has been provided to to let macros leave the environment in the same state that functions 'saveVars' and 'restoreVars' have been provided previously defined function. Macros can set variables. The Macros lines can be as simple as the name of a function or functions (see above). Macros can be bound to keys in exactly the same manner as hilited, the entire window is loaded by the same command. Selection" item of the 'Customize' window. If no text is accomplished by hiliting the text and selecting the "Load bound to keystrokes. Loading a macro or a binding is These macro declarations can then be edited, loaded, and only of letters of the alphabet, digits, and '_'. function prompts you for a macro name, which must consist 'Dump Function' from the 'Utilities' menu. The dump Utilities' menu) or written into a buffer by selecting executeKeyboardMacro' (this function is also in the ' keystrokes to be played back later w/ the function ' ALPHA supports keyboard macros which record a sequence of ========================== Defining and Using Macros permanently add an 'ACMD' to Alpha, use ResEdit. type 'ACMD', but are not added to the menu. To keystrokes). ACMDs can be executed from other files of macros (macros allow ACMD functions to be bound to the ACMD menu under 'Utilities' and are callable from ACMD's that are in the 'Alpha' resource fork are added to • The ACMD resource is released. text. • The original selection is replaced with the transformed parater of type 'char *'. should be declared as type 'char *', taking a single result. Therefore, your code resource's 'main' routine • The ACMD transforms the string, and returns it as it's the string as it's only parameter. 'AEXT') is loaded, and called as a 'C' function w/ • The first 'ACMD' resource in the chosen file (type returns to delimit lines. The string will be null-terminated w/ carriage • The selection (if any) is copied into the new pointer. size of the current selection + 1. • A new pointer is allocated with size equal to the characters delimit individual lines. In summary: be at least size 1 and is null-terminated. Carriage return when it is no longer needed. The input string will always the ACMD should de-allocate the input string w/ DisposPtr larger chunk of text than was passed in). In this case, ACMD allocated itself (say, if the ACMD wanted to return a was passed in to the ACMD, or it could be a block that the This output string could be the same block of memory that and the output string must be allocated w/ NewPtr as well. it's result. The input string is allocated w/ 'NewPtr', pointer as an argument and returns a string pointer as resource is just a code resource that takes a string executed to transform the current selection. An 'ACMD' Alpha command (ACMD) code resources can be loaded and (say, like Preditor), we can do that too. some other way of limiting the amount of undo information of memory constraints, but if enough people would prefer disk currently flushes the undo buffer. I did this because Another point to bear in mind is that saving a buffer to it for a while. not redone are lost. If this is confusing, just play with new modifications, all changes that you have undone but you undid :-) too far. Bear in mind that once you create you make to your file can be undone, and then redone if every supported (everything but 'insertFile') change that ALPHA supports unlimited undo and redo. This means that "Load Selection", and only the hilited text get loaded. 3) If a selection is hilited, the above item changes to an entire window at once. 2) The "Load Window" item of the Customize menu loads 1) The 'AlphaBits' file is always loaded at startup. loaded in one of three ways: Bindings, variable definitions, and macros can all be while the classic mac template uses the option key. up w/ the 'control' key for emacs command combinations, this is not necessary. The default MacII template is set key. Newer Macs have both an escape and a command key, so backquote key and use the option key for the emacs command For the Classic Macs, we map the escape key to the control key. emacs key bindings. Emacs uses an escape key and a mac application. Problems arise in ALPHA's emulation of ALPHA's default setup uses the command key like any other ( Disables the item a keyboard equivalent with the item / Followed by a character, associates the character style of the item < Followed by B, I, U, O, or S, sets item with that character ! Followed by a character, marks the that icon to the item ^ Followed by an icon number, adds ; or Return Separates multiple items -------------- ----- Meta-character Usage in the data string: Program", the following meta-characters may be embedded As described in the section "Creating a Menu in Your characters can be embedded in the strings: 'AlphaBits' file for an example. The following meta the bindings. The syntax is dead simple. See the in the menus, as opposed to being merely callable through contains names of functions or macros that just HAVE to be Alpha allows the the user to build up a custom menu which • The 'User' Menu See Macros • Macro Definition (set dumString "the string") an analogous fashion: There are also a few string variables, which are bound in (set sillyVar on) respectively, so the above example could be written: The values 'on' and 'off' map to '1' and '0', (set sillyVar 1) Variables are defined as follows: There are many user-definable integer variables in ALPHA. • Setting Variables by using an external tool like 'ResEdit'. over bindings. Command equivalents can only be changed Note that menu item command equivalents take precedence string is optional in this form as well. because 1 is the ascii code for control-a. The modifier (ascii 1 beginningOfLine) the ascii binding will be: (bind 'a' beginningOfLine) 'beginningOfLine' is: entered in decimal. Whereas the normal binding for keycode conversion. However, the ascii code must be keyboards, another form was added which bypasses the Because the hardcoded key codes reflect only the US extra bindings are used for a DataDesk 101 keyboard. necessary mappings for the original mac keyboards, the The loaded bindings will actually be a superset of the "#define OLDMAC ....." with an original mac keyboard, uncomment the line: forms, the modifier string is optional. To use ALPHA between the single quotes instead of an 'a'). In both binding for control-a would have to have a 'control-a' would also have to reflect the modifier keys, (i.e. the table. If this was not done, the char in the quotes are converted to key codes through lookup in a hardcoded that both forms are machine-dependent. The ascii chars the 'keyCode' function. It is important to recognise The key code for any given key can be obtained by using (bind '\6f' forwardChar) forwardChar' on a datadesk-101 keyboard: The following line binds F13 to the function ' (bind '\<2-digit hex key code>' [modifier string] funcName) including function keys: you to bind the rest of the keys on your keyboard, owners will want to do. A second form of binding allows 'convertToCodes' is set to 'off', which foreign keyboard keycode through a hard-coded table unless the var This form actually converts the ascii code into a US (bind 'f' forwardChar) 'forwardChar': The following line binds cmd-shift-f to the function x - prefixChar modifier e - escape modifier z - control modifier s - shift modifier o - option modifier c - command modifier containing one or more of: where c is a character, 'modifier string' is a string (bind '' [modifier string] funcName) statement such as: keystroke. One way to bind a function is with a Any function or loaded macro can be bound to any single • Key Bindings the Alphabit file: tastes. There are three different types of statements in The AlphaBits file allows you to customize ALPHA to your ================================= Customizing ALPHA item from the "Customie" menu. for that variable, or selecting the "File Sets..." menu This variable can be changed by loading a new definition fileset, which is specified by the 'fileSet' variable. Functions that use file sets operate on the "current" "bindings.c" and "center.c". defines a fileset named 'edit1' which contains the files "jpl341:Pete:Alpha.101:edit:center.c") "jpl341:Pete:Alpha.101:edit:bindings.c" (fileSet edit1 For example: ( fileSet ""* ) follows: definition. The syntax for file set definitions is as file search. File sets are defined by loading a file set to use for functions such as 'createTagsFile', and multi- File Sets are used to specify a list of files for ALPHA ================================= Defining and Using File Sets anyone else). refurbished ~1984 machine, so it hurts me as much as on 8MHz machines. This WILL change (I work on a my first pass is a recursive function that is rather slow Regular expressions are very powerful, but unfortunately ^[^ \t#]*(.*)$ declaration might be: EXAMPLE: A regular expression to look for the next function regular regular expressions. concatenated to other regular expressions to create larger constructed from one of the above elements can be '\' is the escape character. Regular expressions * zero or more occurences of the previous pattern [^...] negated character class inside classes [...] character class, can use ranges such as '0-9' . any character except newline $ end of line ^ beginning of line